//
//  EditPassworldViewController.m
//  RENTVISITOR
//
//  Created by wonder on 2017/8/30.
//  Copyright © 2017年 UNN. All rights reserved.
//

#import "EditPassworldViewController.h"
#import "RentVieitor.h"
#import "PhoneVerifyViewController.h"

@interface EditPassworldViewController ()

@end

@implementation EditPassworldViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"修改密码";
    self.view.backgroundColor = BackgroundColor;
    [self creatLeftView];
    [self creatView];
}

- (void)creatLeftView {
    
    // 自定义导航栏左侧按钮
    UIButton * leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(0, 0, 80,15 );
    [leftBtn setImage:[UIImage imageNamed:@"箭头左"] forState:UIControlStateNormal];
    [leftBtn setTitle:@"个人信息" forState:UIControlStateNormal];
    leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [leftBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];
    leftBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [leftBtn setTitleColor:[Utils colorConvertFromString:@"#333333"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    self.navigationItem.leftBarButtonItem = leftItem;
    
}


- (void)creatView {
    
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake((KWidth-100)/2, 45, 100,100*230/155)];
    imgView.image = [UIImage imageNamed:@"shouji"];
    [self.view addSubview:imgView];
    
    CGFloat h = 100*230/155+45;
    UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, h+30, KWidth/2, 30)];
    textLabel.text = @"您已经设置密码:";
    textLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    textLabel.font = [UIFont boldSystemFontOfSize:17];
    textLabel.textAlignment = NSTextAlignmentRight;
    [self.view addSubview:textLabel];
    
    UILabel *phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(KWidth/2+10, h+30, KWidth/2-10, 30)];
    phoneLabel.text = @"*********";
    phoneLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    phoneLabel.font = [UIFont boldSystemFontOfSize:17];
    phoneLabel.textAlignment = NSTextAlignmentLeft;
    [self.view addSubview:phoneLabel];
    
    UILabel *proLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, h+50+10, KWidth, 15)];
    proLabel.text = @"如需更改密码请点击下方按钮";
    proLabel.textColor = [Utils colorConvertFromString:@"#666666"];
    proLabel.font = [UIFont systemFontOfSize:12];
    proLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:proLabel];
    
    UIButton *changeBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    changeBtn.frame = CGRectMake(30,h+60+10+15+50, KWidth-60, 40);
    [changeBtn setBackgroundColor:[UIColor colorWithRed:249/255.0 green:105/255.0 blue:39/255.0 alpha:1]];
    [changeBtn setTitle:@"更换密码" forState:UIControlStateNormal];
    [changeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    changeBtn.layer.masksToBounds = YES;
    [changeBtn addTarget:self action:@selector(changeAction) forControlEvents:UIControlEventTouchUpInside];
    changeBtn.layer.cornerRadius = 2;
    [self.view addSubview:changeBtn];
    
}

- (void)changeAction {
    
    PhoneVerifyViewController *editPVc = [[PhoneVerifyViewController alloc] init];
    editPVc.phone = self.phone;
    editPVc.type = 1;
    [self.navigationController pushViewController:editPVc animated:YES];
}

- (void)backAction {
    
    [self.navigationController popViewControllerAnimated:YES];
}

@end
